Page({

    /**
     * 页面的初始数据
     */
    data: {
        dataList: [{
            goods_id: 2,
            goods_title: '天山天池1',
            goods_img: '../image/ceshi.jpg',
            goods_xiaoliang: '0',
            goods_price: '60'
        }, {
            goods_id: 2,
            goods_title: '天山天池2',
            goods_img: '../image/ceshi.jpg',
            goods_xiaoliang: '0',
            goods_price: '70'
        }, {
            goods_id: 2,
            goods_title: '天山天池3',
            goods_img: '../image/ceshi.jpg',
            goods_xiaoliang: '0',
            goods_price: '80'
        }, {
            goods_id: 2,
            goods_title: '天山天池4',
            goods_img: '../image/ceshi.jpg',
            goods_xiaoliang: '0',
            goods_price: '90'
        }, {
            goods_id: 2,
            goods_title: '天山天池5',
            goods_img: '../image/ceshi.jpg',
            goods_xiaoliang: '0',
            goods_price: '110'
        }],
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        var that = this;
        if (this.data.currentTab === 0) {
            return false;
        } else {
            that.setData({
                currentTab: 0,
            })
        }
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    },
    //跳转到商品详情页面
    goodsDetail: function(e) {
        // let ins = encodeURIComponent('id=2' + e.currentTarget.dataset.id);
        let ins = encodeURIComponent('id=1');
        wx.navigateTo({
            url: '../goods/details/details?scene=' + ins
        });
    },
    clickTab: function(e) {
        var that = this;
        if (this.data.currentTab === e.target.dataset.current) {
            return false;
        } else {
            that.setData({
                currentTab: e.target.dataset.current,
            })
        }
    }
})